package de.baumann.browser.activitys.order

import android.annotation.SuppressLint
import android.widget.TextView
import de.baumann.browser.R
import de.baumann.browser.base.BaseOdinActivity
import de.baumann.browser.iview.IRechargeOrderDetailView
import de.baumann.browser.present.RechargeOrderDetaiPresenter
import de.baumann.browser.utils.StringUtil
import de.baumann.browser.utils.getUser
import kotlinx.android.synthetic.main.include_tool_bar.*

@Deprecated("功能已删除")
class RechargeOrderDetailActivity : BaseOdinActivity<IRechargeOrderDetailView, RechargeOrderDetaiPresenter>(), IRechargeOrderDetailView {


    override fun getTitleText(): String {
        return getString(R.string.order_detail)
    }

    override fun getLayout(): Int {
        return R.layout.activity_recharge_detail
    }

    override fun initView() {
        initToolbar(commToolBar,commTitle)

        if (getUser() != null) {
            findViewById<TextView>(R.id.textOrT).text = String.format(resources.getString(R.string.or_t), getUser()!!.service_qq)
        }

        findViewById<TextView>(R.id.tvCopyText40).setOnClickListener {
            StringUtil.copy(mContext,findViewById<TextView>(R.id.text40).text.toString())
            showShortToast(getString(R.string.tid_copied_to_the_clipboard))
        }

        findViewById<TextView>(R.id.tvCopyText41).setOnClickListener {
            StringUtil.copy(mContext,findViewById<TextView>(R.id.text41).text.toString())
            showShortToast(getString(R.string.arrival_address_been_copied_to_the_clipboard))
        }

    }

    override fun createPresenter(): RechargeOrderDetaiPresenter {
        return RechargeOrderDetaiPresenter()
    }

    override fun createView(): IRechargeOrderDetailView {
        return this
    }

    override fun initData() {
        presenter.getRechargeDetail()
    }


    override fun getOrderId(): String {
        return intent.getStringExtra("orderId")
    }

    @SuppressLint("SetTextI18n")
    override fun setRechargeAmount(amount: String) {
        findViewById<TextView>(R.id.text38).text = "$amount ODIN"
    }

    override fun setRechargeId(id: String) {
        findViewById<TextView>(R.id.text39).text = id
    }

    override fun setTransactionId(id: String) {
        findViewById<TextView>(R.id.text40).text = id
    }

    override fun setArrivald(id: String) {
        findViewById<TextView>(R.id.text41).text = id
    }

    override fun setTime(time: String) {
        findViewById<TextView>(R.id.text42).text = time
    }

    @SuppressLint("SetTextI18n")
    override fun actualArrival(amount: String) {
        findViewById<TextView>(R.id.text43).text = "$amount ODIN"
    }

    @SuppressLint("SetTextI18n")
    override fun handlingFee(fee: String) {
        findViewById<TextView>(R.id.text44).text = "$fee ODIN"
    }

    override fun setRechargeStatus(status: Int, remark: String) {
        val tvStatus = findViewById<TextView>(R.id.tvStatus)
        if (status == 1){
            tvStatus.text = getString(R.string.recharge_successful)
        }else{
            tvStatus.text = remark
            tvStatus.setTextColor(mContext.resources.getColor(R.color.color_txt_red))
        }
    }
}
